package com.kern.jpademo.service;

import com.kern.jpademo.dao.IAuthorDAO;
import com.kern.jpademo.entity.XAuthor;
import com.kern.jpademo.util.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by caoshi at 7:17 2021-08-01
 */
@Service
public class AuthorService {


    @Autowired
    private IAuthorDAO authorDAO;

    public int add() {

        XAuthor a1 = new XAuthor(CommonUtil.getUUID(), "张三", 8000.0, "架构师");
        XAuthor a2 = new XAuthor(CommonUtil.getUUID(), "李四", 7500.0, "前端程序员");
        XAuthor a3 = new XAuthor(CommonUtil.getUUID(), "陈明", 6000.0, "产品经理");
        XAuthor a4 = new XAuthor(CommonUtil.getUUID(), "王二狗", 8000.0, "后端程序员");

        authorDAO.save(a1);
        authorDAO.save(a2);
        authorDAO.save(a3);
        authorDAO.save(a4);

        return 1;
    }


    public void testQuery1() {
        XAuthor lisi = authorDAO.findByName("李四");
        System.out.println(lisi);
    }






}
